/*

 * and open the template in the editor.
 */

package hcmus.fit.master.sevensea.control;

import java.util.ArrayList;
import java.util.List;

import android.graphics.Bitmap;
import android.graphics.Canvas;

/**
 * 
 * @author hvp
 */
public class Score {
    public static List Resources;
    public int SCORE;

    public Score(int score) {
        SCORE = score;
    }

    public void Show(Canvas g, int x, int y) {

        List list = new ArrayList();

        int score = SCORE;
        while (score > 0) {
            list.add(new Integer(score % 10));
            score /= 10;
        }
        if (list.size() <= 0)
            list.add(new Integer(0));

        x -= (list.size() * 11 / 2);

        for (int i = 0; i < list.size(); i++) {
            // int num = ((Integer)list.get(list.size()-i-1)).intValue();
            // Image tmp = (Image) Resources.get(num);
            // int w = tmp.getWidth();
            // g.drawImage(tmp, x + i*w, y, Graphics.TOP|Graphics.LEFT);

            // ImageAttributes imgatt = new ImageAttributes();
            // imgatt.SetColorKey(tmp.GetPixel(0, 0), tmp.GetPixel(0, 0));
            // g.DrawImage(tmp, new Rectangle(x + i*(w * 2 / 3), y, w * 2 / 3, h
            // * 2 /3), 0, 0, tmp.Width, tmp.Height,
            // GraphicsUnit.Pixel, imgatt);

        }

    }

    public static List GetResource(Bitmap resource, int maxX, int maxY, int numerator, int denominator) {
        List rs = new ArrayList();
        int w = resource.getWidth() / maxX;
        int h = resource.getHeight() / maxY;

        for (int i = 0; i < maxY; i++) {
            for (int j = 0; j < maxX; j++) {
                // Image tmp = Image.createImage(resource, j * w, i * h, w, h,
                // Sprite.TRANS_NONE);
                // rs.add(tmp);
            }
        }
        return rs;
    }
}
